﻿@{
    ViewBag.Title = "RecoveryIndex";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script src="~/Content/js/datepicker/WdatePicker.js"></script>
<script>
    $(function() {
        gridList();
    });
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/Project/GudaoCar/GetGridJsonRecovery",
            height: $(window).height() - 96,
            colModel: [
                { label: "主键", name: "F_Id", hidden: true, key: true },
                {
                    label: '车号',
                    name: 'BelongCarriage',
                    width: 50,
                    align: 'left',
                    formatter: function(cellvalue) {
                        debugger;
                        return cellvalue != null ? cellvalue.CarriageID : "未填写";
                    }
                },
                {
                    label: '股道',
                    name: 'BelongPathway',
                    width: 50,
                    align: 'left',
                    formatter: function(cellvalue) {
                        debugger;
                        return cellvalue != null ? cellvalue.Name : "未填写";
                    }
                },

                {
                    label: '车型',
                    name: 'BelongCarriage',
                    width: 50,
                    align: 'left',
                    formatter: function(cellvalue) {
                        debugger;
                        return cellvalue != null ? cellvalue.CarType : "未填写";
                    }
                },
                {
                    label: '载重(吨)',
                    name: 'BelongCarriage',
                    width: 50,
                    align: 'left',
                    formatter: function(cellvalue) {
                        debugger;
                        return cellvalue != null ? cellvalue.Capacity : "未填写";
                    }
                },
                {
                    label: '品名',
                    name: 'ThingsName',
                    width: 50,
                    align: 'left'
                },
                {
                    label: '封号',
                    name: 'Fenhao',
                    width: 100,
                    align: 'left'
                },
                {
                    label: '到站',
                    name: 'ArriveStation',
                    width: 80,
                    align: 'left'
                },
                {
                    label: '件数',
                    name: 'UnitNumber',
                    width: 40,
                    align: 'left',
                    formatter: function(cellvalue) {
                        return cellvalue == null ? "0" : cellvalue;
                    }

                },
                {
                    label: '重量(吨)',
                    name: 'Weight',
                    width: 50,
                    align: 'left',
                    formatter: function(cellvalue) {
                        return cellvalue == null ? "0" : cellvalue;
                    }
                },
                {
                    label: '卸后利用时间',
                    name: 'RecoveryTime',
                    width: 120,
                    align: 'center',
                    formatter: function(cellvalue) {
                        return cellvalue == null ? " " : cellvalue;
                    }
                },
                {
                    label: '操作调度员',
                    name: 'RecoveryOper',
                    width: 100,
                    align: 'center',
                    formatter: function(cellvalue) {
                        return cellvalue == null ? " " : cellvalue.OperationPersion.F_RealName;
                    }
                },
                {
                    label: '备注', name: 'Remark', width: 100, align: 'center'
                }
            ],
            pager: "#gridPager",
            sortname: 'F_CreatorTime desc',
            viewrecords: true

        });
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                postData: {
                    keyword: $("#txt_keyword").val(),
                    carId: $("#carId").val(),
                    StartTime: $("#sTime").val(),
                    EndTime: $("#eTime").val()
                }
            }).trigger('reloadGrid');
        });
    }
    function btn_add() {
        $.modalOpen({
            id: "Form",
            title: "添加股道",
            url: "/Project/Pathway/Form",
            width: "650px",
            height: "650px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }
    function btn_edit() {
        var keyValue = $("#gridList").jqGridRowValue().F_Id;
        $.modalOpen({
            id: "Form",
            title: "修改股道信息",
            url: "/Project/Pathway/Form?keyValue=" + keyValue,
            width: "650px",
            height: "650px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }
    function btn_delete() {

        $.deleteForm({
            url: "/Project/Pathway/DeleteForm",
            param: { keyValue: $("#gridList").jqGridRowValue().F_Id },
            success: function() {
                $.currentWindow().$("#gridList").resetSelection();
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        });
    }
    function btn_details() {
        var keyValue = $("#gridList").jqGridRowValue().F_Id;
        $.modalOpen({
            id: "Details",
            title: "查看股道详情",
            url: "/Project/Pathway/Details?keyValue=" + keyValue,
            width: "1000px",
            height: "720px",
            btn: null
        });
    }

</script>


<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            @*<a id="NF-add" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新增股道</a>*@
        </div>
        @*<div class="operate">*@
        @*<ul class="nav nav-pills">*@
        @*<li class="first">已选中<span>1</span>项</li>*@
        @*<li><a id="NF-edit" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改股道</a></li>
            <li><a id="NF-delete" onclick="btn_delete()"><i class="fa fa-trash-o"></i>删除股道</a></li>*@
        @*<li><a id="NF-Details" onclick="btn_details()"><i class="fa fa-search-plus"></i>查看详情</a></li>*@
        @*<li class="split"></li>*@
        @*</ul>*@
        @*<a href="javascript:;" class="close"></a>*@
        @*</div>*@
        <script>$('.toolbar').authorizeButton()</script>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group" style="padding-left:11px;padding-right:10px;">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="按照股道名模糊搜索" style="width: 200px; margin-right:20px;">
                        <input id="carId" type="text" class="form-control" placeholder="按照车号模糊搜索" style="width: 200px; margin-right:20px;">
                        <input id="sTime" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" placeholder="输入开始查询时间" style="width: 200px; margin-right:20px;">
                        <input id="eTime" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" placeholder="输入结束查询时间" style="width: 200px; margin-right:20px;">
                        @*<input id="txt_name" type="text" class="form-control" placeholder="按照场主名称模糊搜索" style="width: 200px; margin-right:20px;">*@
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary active"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<style>
    table tr td {
        padding-left: 15px;
    }
</style>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>




